import request from '@/utils/Request'

//查询自己所出售的商品
export const loadSellerProductApi = (data) =>{
    return request.get('/sellerProduct/selectPage',{
        params:data
    })
}

/**
 * 保存出售的商品
 * @param form
 * @returns {*}
 */
export const saveSellerProductApi = (form) =>{
    const url = form.sellerProductId ? '/sellerProduct/update' : '/sellerProduct/add'
    const method = form.sellerProductId ? 'PUT' : 'POST'
    return request({
        url,
        method,
        data: form,
    })
}
/**
 * 删除出售的商品
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const deleteSellerProductApi = (id) =>{
    return request.delete('/sellerProduct/delete/'+id)
}
/**
 * 批量删除出售的商品
 * @param ids
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const deleteBatchSellerProductApi = (ids) =>{
    return request.delete('/sellerProduct/delete/batch', { data: ids })
}
/**
 * 库存预警
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const loadStockNotEnough=(data)=>{
    return request.get('/sellerProduct/selectStockNotEnough',{
        params : data
    })
}
/**
 * 库存推荐
 * @param id
 */
export const loadInventoryRecommendation = (id) => {
    return request.get('/sellerProduct/inventoryRecommendation/'+id)
}

/**
 * 批量盘点数据
 */

export const updateBatch = (data) => {
    return request.post('/sellerProduct/updateBatch',data)
}